Skip to content

Instantly share code, notes, and snippets.

View cesurapp's full-sized avatar
🎯
odaklanma

Cesur APAYDIN cesurapp

🎯
odaklanma
View GitHub Profile
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@KaduNovoK
KaduNovoK / transaction.php
Created January 8, 2014 11:42
Transactions in Symfony 2 and Doctrine 2
<?php
// Code sample to use Transactions
// Get the Entity Manager
$em = $this->getDoctrine()->getEntityManager();
// Suspend the auto-commit
$em->getConnection()->beginTransaction();
@demircancelebi
demircancelebi / reset.js
Created July 9, 2015 00:57
node.js modem reset
/*
Usage:
You should allow telnet in modem settings beforehand (might be allowed already)
You should set opts according to your modem settings
loginText = When you try `telnet 192.168.2.1` in terminal
it asks you login name for the modem. Change
this text to something you see on that line.
I saw my modem name and used that.
@vhdm
vhdm / google2fa.php
Last active June 5, 2024 08:11
Google TOTP Two-factor Authentication for PHP
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@markjlorenz
markjlorenz / simple-exec-with-docker-remote-api.sh
Created July 23, 2016 16:05
Using the exec command with the docker API, and capturing output
#! /usr/bin/env bash
# Create the container with a long running process. If PID1 exists before
# we send the exec commands, they will fail because the container is not running
#
CONTAINER_NAME="TEST-`uuidgen`"
curl --silent --unix-socket /var/run/docker.sock "http:/containers/create?name=${CONTAINER_NAME}" -XPOST \
-H "Content-Type: application/json" \
-d '{
"Image": "ruby:latest",
@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active August 15, 2024 07:10
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin