Skip to content

Instantly share code, notes, and snippets.

View yitsushi's full-sized avatar
🏳️‍⚧️

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
@yitsushi
yitsushi / delete_slack_files.rb
Last active October 3, 2016 15:49
set Env TOKEN to your personal (or an admin) token (bot token does not work)
require "slack"
client = Slack::Client.new token: ENV['TOKEN']
LIMIT = 20 # days
from_time = Time.now.to_i - (60 * 60 * 24 * LIMIT)
pages = client.files_list(:types => 'images', ts_to: from_time)['paging']['pages'].to_i
deleted_files_count = 0
@yitsushi
yitsushi / delete_my_slack_files.rb
Created October 3, 2016 15:51
delete old slack files (only images)
require "slack"
#
# gem install slack-api
#
# Get the token from here: https://api.slack.com/docs/oauth-test-tokens
#
client = Slack::Client.new token: ENV['TOKEN']
@yitsushi
yitsushi / git-update-from-remote.sh
Created October 7, 2016 11:16
fetch remote branch and rebase it. If working directory is dirty than stash them first and apply stash after update
# stashq is an alias to prevend auto-sign stashes (prompt for password):
# git config --global alias.stashq '-c commit.gpgsign=false stash'
function update-from-remote() {
remote=${1:-"origin"}
branch=${2:-"master"}
if ! git remote | grep "${remote}" > /dev/null; then
echo "There is no remote like ${remote}"
return 1
fi
# Select them
jQuery('.wishlistRow').on('click', function() { jQuery(this).toggleClass('wanttoremove'); });
# Finish
jQuery('.wanttoremove').each(function() {
var id = this.getAttribute('id').split('_')[1];
jQuery.post(
'/id/yitsushi/wishlist/',
{
appid: id,
Verifying my Blockstack ID is secured with the address 1JpEjoxTu3d4gMDipmgrekXRvkENs9Ya7r
<?php
$with_unsused = false;
define('LIMIT', 1000000);
class MyClass {
public function test() {}
}
function callSomething() {
@yitsushi
yitsushi / homebrew-news.sh
Created March 5, 2018 11:45
homebrew-news is a simple shell script to list changes in Formulas, for example spotting new apps, renamed or deleted Formulas.
#!/bin/bash
days=${1:-1}
current_dir=$(pwd)
homebrew_prefix=$(brew --prefix)
for formula_dir in $(find ${homebrew_prefix}/Homebrew/Library/Taps -name "Formula" -type d); do
cd $formula_dir
// Single-Click Version:
// 1. Create a bookmark with:
javascript:document.body.addEventListener("click",function(t){for(var e=window.getSelection(),n=e.getRangeAt(0),o=e.anchorNode;0!=n.toString().indexOf(" ");)n.setStart(o,n.startOffset-1);n.setStart(o,n.startOffset+1);do{n.setEnd(o,n.endOffset+1)}while(-1==n.toString().indexOf(" ")&&""!=n.toString().trim()&&n.endOffset<o.length);n.toString().trim();e.focusNode.nodeValue=e.focusNode.nodeValue.replace(n.toString().trim(),"***")});
// 2. Place your bookmark on your bookmarks bar
// 3. Push the button when you want to censor your name / anything else
// 4. Click on the word you want to hide
// Double-Click Version:
javascript:document.body.addEventListener("dblclick",function(t){for(var e=window.getSelection(),n=e.getRangeAt(0),o=e.anchorNode;0!=n.toString().indexOf(" ");)n.setStart(o,n.startOffset-1);n.setStart(o,n.startOffset+1);do{n.setEnd(o,n.endOffset+1)}while(-1==n.toString().indexOf(" ")&&""!=n.toString().trim()&&n.endOffset<o.length);n.toString().trim
@yitsushi
yitsushi / archive.py
Last active January 7, 2019 20:33
Archive files (photos/screenshots/videos etc). I have when I have 1000+ files in a single directory
#!/usr/bin/env python3
import os
from datetime import datetime
from multiprocessing import Pool
def is_image(x):
return x.endswith('.jpg') or x.endswith('.png')
def is_movie(x):
@yitsushi
yitsushi / breaches.py
Created January 21, 2019 14:31
Check all the breaches
#!/usr/bin/env python3
import requests
import argparse
import json
"""
Example usage:
# From file
$ breaches --filename my_account_list