Skip to content

Instantly share code, notes, and snippets.

View jimmystridh's full-sized avatar
👾

Jimmy Stridh jimmystridh

👾
View GitHub Profile
@selenamarie
selenamarie / a_better_opml.py
Last active December 11, 2015 09:59
This grabs URLs associated with the people you follow on Twitter and then tries to scrape RSS feeds from the URLs. You have to get OAUTH creds from dev.twitter.com/apps to do this, and then register the script so that you get the access_token + access_token_secret. Rev 2 actually produces valid OPML. ;)
#!/usr/bin/env python
import tweepy
from BeautifulSoup import BeautifulSoup as parser
import urllib
import sys
import argparse
import ConfigParser
@danbarua
danbarua / gist:3528413
Created August 30, 2012 13:21
RabbitMQ reliable consumer pattern
while (_isRunning)
{
try
{
if (channel == null || consumer == null)
{
try
{
_connection = factory.CreateConnection();
channel = _connection.CreateModel();
@kdisneur
kdisneur / a.md
Created September 11, 2012 19:52 — forked from menkel/a.md
Proxy for Netfix, Hulu....

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Netflix
  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
@jchris
jchris / Couchbase Lite with React Native.md
Last active May 4, 2018 04:29
Couchbase Lite with React Native

Couchbase Lite with React Native

I went into this expecting a challenge but it was easy. Basically, Couchbase Lite has always had an optional HTTP listener that you can connect to from inside your app at http://lite.couchbase./mydatabase/. React Native has a fine XHR module and encourages using fetch so getting your app to sync can be as easy as adding some API calls to keep JSON in the database.

We haven't done a full example yet, but in the spirit of possiblity, here are quick instructions to connect Couchbase Lite iOS with a React Native app (generated from their cli).

@appastair
appastair / crontab
Last active April 12, 2019 22:29
mysqldump diff
@midnight "sh /home/user/mysqldiff-backup.sh"
@suwhs
suwhs / NotificationService.java
Created November 5, 2015 18:59
Android: Catch Other Apps Notifcations With Accessibility Service
package su.whs.notifications;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Notification;
import android.view.accessibility.AccessibilityEvent;
public class NotificationService extends AccessibilityService {
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
@viktorklang
viktorklang / linearize.scala
Created August 14, 2012 10:02
A Linearized version of Sequence
import scala.concurrent._
import scala.collection.mutable.Builder
import scala.collection.generic.CanBuildFrom
import language.higherKinds
/**
* Linearize asynchrnously applies a given function in-order to a sequence of values, producing a Future with the result of the function applications.
* Execution of subsequent entries will be aborted if an exception is thrown in the application of the function.
*/
def linearize[T, U, C[T] <: Traversable[T]](s: C[T])(f: T => U)(implicit cbf: CanBuildFrom[C[T], U, C[U]], e: ExecutionContext): Future[C[U]] = {
@damieng
damieng / WinDev.ps1
Last active March 4, 2020 19:09
Make Windows more developer-workstation oriented (includes removing crapware)
# Run this from Powershell as Administrator with (New-Object System.Net.WebClient).DownloadString("https://gist.github.com/damieng/881852e7112be7d97957/raw") | powershell -command -
Write-Output "Making Windows more developer oriented (Revision 26)..."
Set-ExecutionPolicy Unrestricted
if ([System.Environment]::OSVersion.Version.Major -ge 10) {
Write-Output " * Detected Windows 10"
Write-Output " * Removing Windows 10 bloatware"
$apps = @(
"Microsoft.3DBuilder"
@aroben
aroben / pstree.ps1
Created May 8, 2013 18:34
Script to print a process tree on Windows
$ProcessesById = @{}
foreach ($Process in (Get-WMIObject -Class Win32_Process)) {
$ProcessesById[$Process.ProcessId] = $Process
}
$ProcessesWithoutParents = @()
$ProcessesByParent = @{}
foreach ($Pair in $ProcessesById.GetEnumerator()) {
$Process = $Pair.Value
@darklow
darklow / elasticsearch.custom.sort.py
Last active May 31, 2022 05:25
ElasticSearch custom sort, based on provided ids array order. Original code from here: http://damienalexandre.fr/post/elasticsearch-ids-query-order Rewritten to new "function_score" syntax Note: You need to remove \n new lines from "script" field in order to get it work.
q = {
"query": {
"function_score": {
"boost_mode": "replace",
"query": {
"ids": {
"values": [
50,
80,
44,