Skip to content

Instantly share code, notes, and snippets.

@goncha
goncha / git-proxy.txt
Last active January 20, 2020 17:20
Git and socks5 proxy
gang@debian:~$ sudo apt-get install netcat-openbsd
gang@debian:~$ cat /usr/local/bin/git-proxy-wrapper
#!/bin/bash
nc -xlocalhost:1080 -X5 $*
gang@debian:~$ export GIT_PROXY_COMMAND=/usr/local/bin/git-proxy-wrapper
// list available fonts
//
// compile with
// clang++ fonts.cc -o fonts -std=c++11 -stdlib=libc++ -framework CoreText -framework CoreFoundation -lc++
//
#include <iostream>
#include <string>
#include <vector>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreText/CoreText.h>
@browny
browny / simple_socket_example.c
Last active June 2, 2024 19:25
simple socket example in C
/* --- Usage --- */
g++ server.c -o server
g++ client.c -o client
./server
./client 127.0.0.1
/* --- server.c --- */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@slightfoot
slightfoot / SearchActivity.java
Last active October 26, 2023 12:28
SearchView example
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import android.content.Context;
import android.content.Intent;
import android.database.AbstractCursor;
import android.database.Cursor;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
@jcyamo
jcyamo / i3-exit
Last active October 9, 2020 10:26
Exit script for the i3 window manager based off of exit script from CrunchBang Linux.
#!/usr/bin/env python
# based on cb-exit used in CrunchBang Linux <http://crunchbanglinux.org/>
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
@rofl0r
rofl0r / init.c
Created August 6, 2013 21:15
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
@mwhite
mwhite / git-aliases.md
Last active June 11, 2024 15:56
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@ssendeavour
ssendeavour / copy-recursively.cpp
Created November 5, 2013 19:28
Copy file and directories recursively in Qt
//https://qt.gitorious.org/qt-creator/qt-creator/source/1a37da73abb60ad06b7e33983ca51b266be5910e:src/app/main.cpp#L13-189
// taken from utils/fileutils.cpp. We can not use utils here since that depends app_version.h.
static bool copyRecursively(const QString &srcFilePath,
const QString &tgtFilePath)
{
QFileInfo srcFileInfo(srcFilePath);
if (srcFileInfo.isDir()) {
QDir targetDir(tgtFilePath);
targetDir.cdUp();
if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName()))
@rxaviers
rxaviers / gist:7360908
Last active June 17, 2024 21:24
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@daleobrien
daleobrien / ncurses_stl.cpp
Created November 18, 2013 21:19
A general purpose example of using ncurses in C++ e.g. with STL strings. Note: copied from http://pastebin.com/jRK9C129
/* ncurses C++
*
* A general purpose example of using ncurses in C++ e.g. with STL strings.
* I guess whatever license ncurses uses applies, otherwise public domain.
*/
# include <algorithm>
# include <iostream>
# include <fstream>
# include <iterator>