Skip to content

Instantly share code, notes, and snippets.

@mtrovo
mtrovo / set_wallpaper.py
Created July 27, 2011 21:06
Simple python script to set the wallpaper on Ubuntu
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import commands
import os.path
from sys import argv
def set_gnome_wallpaper(file_path):
command = "gconftool-2 --set \
/desktop/gnome/background/picture_filename \
@jm3
jm3 / looking for the mouse.md
Last active May 2, 2024 14:11
Gin, Television, and Social Surplus

Gin, Television, and Social Surplus, or, “Looking for the Mouse”

Clay Shirky / April 26, 2008

transcription of a speech [Clay Shirky] gave at the Web 2.0 in 2008, emphasis by @jm3

I was recently reminded of some reading I did in college, way back in the last century, by a British historian arguing that the critical technology, for the early phase of the industrial revolution, was gin.

The transformation from rural to urban life was so sudden, and so wrenching, that the only thing society could do to manage was to drink itself into a stupor for a generation. The stories from that era are amazing-- there were gin pushcarts working their way through the streets of London.

And it wasn't until society woke up from that collective bender that we actually started to get the institutional structures that we associate with the industrial revolution today. Things like public libraries and museums, increasingly broad education for children, elected leaders--a lot of th

@azhtom
azhtom / horizontally center align text with PIL
Created April 17, 2016 23:49
horizontally center align text with PIL
font_size = 60
text = 'your text'
rgb_color = (255,255,255)
img = Image.open('your-image.jpg')
draw = ImageDraw.Draw(img)
font = ImageFont.truetype('your-font.ttf', font_size)
w, h = draw.textsize(text, font)
@xposedbones
xposedbones / map.js
Last active June 17, 2024 02:30
Javascript Map range of number to another range
Number.prototype.map = function (in_min, in_max, out_min, out_max) {
return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
@wojteklu
wojteklu / clean_code.md
Last active June 26, 2024 20:51
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@alexcasalboni
alexcasalboni / amazon-rekognition.md
Last active September 6, 2023 15:20
Amazon Rekognition - Python Code Samples

Amazon Rekognition - Python Code Samples

  1. Labels Detection
  2. Faces Detection
  3. Faces Comparison
  4. Faces Indexing
  5. Faces Search
@GeekyShiva
GeekyShiva / Bing_Wallpaper_Changer.py
Created January 12, 2017 19:41
This is a python script that changes the wallpaper of ubuntu desktop to the bing's photo of the day. Tested successfully on ubuntu 14.04. (kubuntu)
import urllib2
import json
import datetime
import os.path, time
from os.path import expanduser
import gconf
import os
import commands
import ctypes
@vickyqian
vickyqian / twitter crawler.txt
Last active May 11, 2024 16:19
A Python script to download all the tweets of a hashtag into a csv
import tweepy
import csv
import pandas as pd
####input your credentials here
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
@bapspatil
bapspatil / ExoPlayerDemoFragment.java
Last active May 10, 2020 09:32
Generic code to set up ExoPlayer in a Fragment
/*
** Created by bapspatil
*/
public class ExoPlayerDemoFragment extends Fragment {
@BindView(R.id.video_exoplayer_view) SimpleExoPlayerView mPlayerView;
private SimpleExoPlayer mPlayer;
private Unbinder unbinder;
public ExoPlayerDemoFragment() {
@xon52
xon52 / xon-GridCanvas.vue
Last active March 5, 2024 09:23
Medium - Flexible Canvas Grid (without blurred lines)
<template>
<canvas class="gridCanvas"
:width="width"
:height="height"
></canvas>
</template>
<script>
export default {
name: 'xon-GridCanvas',