Skip to content

Instantly share code, notes, and snippets.

@0xjams
0xjams / student-score-filter.py
Created October 15, 2024 01:16
Get students with grades ge 40 and below 70
import csv
import sys
import re
def print_csv_info(file_path):
try:
with open(file_path, 'r', encoding='utf-8-sig') as csvfile:
dialect = csv.Sniffer().sniff(csvfile.read(1024))
csvfile.seek(0)
reader = csv.reader(csvfile, dialect)
@0xjams
0xjams / postman-deb.sh
Last active April 2, 2024 21:20 — forked from SanderTheDragon/postman-deb.sh
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2022 SanderTheDragon <[email protected]>
#
# SPDX-License-Identifier: MIT
curlExists=$(command -v curl)
echo "Testing Postman version"
blueprint:
name: Door activated light (at night)
description: Turn the light on to brightness when door is open (depending on time interval)
domain: automation
input:
motion_entity:
name: Door Sensor
selector:
entity:
domain: binary_sensor
blueprint:
name: Motion activated (switches)
description: Turn the light on to brightness when motion is detected, depending on the selected time period, different brightness and turn-on time.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
@0xjams
0xjams / namecheap_ddns_updater_pfsense.sh
Created October 29, 2019 16:01
Namecheap DDNS updater for pfsense, this one had to be updated for tcsh. Most public ones are written for bash
#!/bin/tcsh
# Shell script to update namecheap.com dynamic dns
# from a pfsense Firewall, had to be adapted from other bash solutions
set DOMAIN=''
set PASSWORD=''
set HOSTNAME=''
set EMAIL=''
set CACHED_IP_FILE='./namecheap_ddns_ip.txt'
@0xjams
0xjams / fix_wordpress.sql
Created August 29, 2018 12:23
Queries to update the base path after migrating Wordpress
UPDATE wp_options SET option_value = replace(option_value, 'http://old.domain/path', 'http://www.new.domain') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://old.domain/path','http://www.new.domain');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old.domain/path', 'http://www.new.domain');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://old.domain/path','http://www.new.domain');
@0xjams
0xjams / unilink_times_highfield.py
Last active July 9, 2018 14:37
Queries the unilink website to get the schedule and to check when a specific bus will arrive.
adb -d shell pm grant com.nolanlawson.logcat android.permission.READ_LOGS
@0xjams
0xjams / disable_voicemail.sh
Created May 10, 2016 23:20
Kill voicemail notification
adb shell am force-stop com.android.phone
@0xjams
0xjams / config.txt
Created March 13, 2016 02:11
Configuration line for compiling nginx and php-fpm
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-ipv6
'./configure' '--prefix=/usr/local/php' '--enable-inline-optimization' '--disable-debug' '--disable-libgcc' '--disable-libtool-lock' '--disable-cgi' '--enable-safe-mode' '--with-libxml-dir' '--enable-dom' '--enable-libxml' '--with-bz2=shared' '--enable-calendar' '--with-zlib-dir=shared' '--with-ttf' '--with-freetype-dir' '--with-mysql=mysqlnd' '--with-mysql-sock' '--with-zlib-dir' '--enable-sockets' '--enable-zip' '--with-pear' '--enable-session' '--with-zend-vm=CALL' '--enable-mbstring' '--with-regex' '--with-openssl' '--with-expat-dir' '--with-pcre-regex' '--enable-xml' '--enable-ctype' '--enable-json' '--enable-pdo' '--with-curl' '--with-pdo-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-gd' '--with-jpeg-dir' '--with-vpx-dir' '--with-xpm-dir=/usr' '--enable-opcache' --enable-fpm