Skip to content

Instantly share code, notes, and snippets.

@simonw
simonw / is_hard.py
Created November 8, 2009 09:06
Python script for telling if two files are hard links to the same thing
#!/usr/bin/env python
"is_hard.py - tell if two files are hard links to the same thing"
import os, sys, stat
def is_hard_link(filename, other):
s1 = os.stat(filename)
s2 = os.stat(other)
return (s1[stat.ST_INO], s1[stat.ST_DEV]) == \
(s2[stat.ST_INO], s2[stat.ST_DEV])
@voyeg3r
voyeg3r / apt-fast
Created May 21, 2010 16:18
apt-fast with aria2c
#!/bin/sh
# Last Change: 2011/10/06
# apt-fast v0.02 by Matt Parnell http://www.mattparnell.com, this thing is fully open-source
# if you do anything cool with it, let me know so I can publish or host it for you
# contact me at admin@mattparnell.com
# Special thanks to Travis/travisn000 from the PCLinux Forums for making improvements that allow
# for more complex apt-get commands. See the thread: http://www.pclinuxos.com/forum/index.php/topic,66385.0.html
# adicionar suporte aos metalinks no aria2: http://ubuntuforums.org/showthread.php?t=1493421
# veja também apt-metalink: http://github.com/tatsuhiro-t/apt-metalink
@laiso
laiso / hatenaoauth_example.py
Last active August 10, 2022 13:29
Pythonではてなの OAuth 対応 API を利用する
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
フレームワークとして Flask(http://flask.pocoo.org/) を、OAuth ライブラリとして oauth2(http://pypi.python.org/pypi/oauth2/) を利用したサンプルプログラムです。
下のコードを保存して (oauth_consumer.py とします)、YOUR_CONSUMER_KEY, YOUR_CONSUMER_SECRET となっている部分を自分の consumer_key, consumer_secret で置き換えます。
$ python oauth_consumer.py
... で起動してから http://localhost:5000 に Web ブラウザでアクセスして下さい。
@thinkhy
thinkhy / MsgWaitForMultipleObjects.cpp
Created June 1, 2011 05:30
Win32 Waitable Timer and MsgWaitForMultipleObjects
////////////////////////////////////////////////////////////////////////////////////
HANDLE hTimer;
LARGE_INTEGER li;
hTimer = CreateWaitableTimer(NULL, FALSE, NULL);
const int nTimerUnitsPerSecond = 10000000;
li.QuadPart = -(30 * nTimerUnitsPerSecond);
@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
@jadonk
jadonk / epolltest.c
Created May 3, 2012 17:41
Quick test using epoll to wait on GPIO events
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/epoll.h>
#include <sys/types.h>
int main(int argc, char** argv) {
@ejh
ejh / leaflet-button-control.js
Created June 15, 2012 08:11
Leaflet control button example
L.Control.Button = L.Control.extend({
options: {
position: 'bottomleft'
},
initialize: function (options) {
this._button = {};
this.setButton(options);
},
@callmephilip
callmephilip / gist:3517765
Created August 29, 2012 19:39
[JavaScript] Dispatching mouse move event
// look here for more details : https://developer.mozilla.org/en-US/docs/DOM/event.initMouseEvent
var mouseMoveEvent = document.createEvent("MouseEvents");
mouseMoveEvent.initMouseEvent(
"mousemove", //event type : click, mousedown, mouseup, mouseover, mousemove, mouseout.
true, //canBubble
false, //cancelable
window, //event's AbstractView : should be window
1, // detail : Event's mouse click count
@unarist
unarist / gist:6342758
Created August 26, 2013 15:32
クリップボードを監視してテキストボックスに追加していく感じの。
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
internal class MainForm : Form
{
[DllImport("user32.dll", SetLastError = true)]
private extern static void AddClipboardFormatListener(IntPtr hwnd);
[DllImport("user32.dll", SetLastError = true)]
@rxaviers
rxaviers / gist:7360908
Last active June 9, 2024 13:43
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: