Skip to content

Instantly share code, notes, and snippets.

View jimmystridh's full-sized avatar
👾

Jimmy Stridh jimmystridh

👾
View GitHub Profile
@dideler
dideler / bot.rb
Last active May 8, 2024 01:20
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@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"
@jackcarter
jackcarter / slack_delete.py
Last active November 29, 2023 07:03
Delete Slack files older than 30 days. Rewrite of https://gist.github.com/jamescmartinez/909401b19c0f779fc9c1
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
@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) {
@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).

@davidfowl
davidfowl / dotnetlayout.md
Last active May 9, 2024 19:43
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@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,
@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
@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