Skip to content

Instantly share code, notes, and snippets.

View darkdreamingdan's full-sized avatar

Dan Chowdhury darkdreamingdan

View GitHub Profile
@darkdreamingdan
darkdreamingdan / .hyper.mac.js
Last active February 21, 2019 23:59
My hyper configuration for Mac
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@darkdreamingdan
darkdreamingdan / .tmux.conf
Created November 11, 2018 01:18
My tmux configuration. Enables colours, uses backtick as a prefix (double backtick to write an actual backtick). Ctrl+d and Ctrl+e for split panes (a la hyper.js)
#enable colours
set -g default-terminal "xterm-256color"
#add ` as prefix
set-option -g prefix2 `
# double tap ` to get a real `
bind ` send-keys `
# split panes using | and -
@darkdreamingdan
darkdreamingdan / .hyper.js
Last active June 27, 2018 17:05
My hyper configuration for Bash for Windows
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@darkdreamingdan
darkdreamingdan / Add Bash to Context Menu.reg
Created September 2, 2017 23:13
Adds 'Open Bash here' to your Windows Context menu for WSL. Based on a registry key from winaero, only this opens `bash.exe` natively so that it appears in the same program group in the start menu as when using `bash.exe` in Start->Run, and also inherits the Ubuntu taskbar icon.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\openbashhere]
@="Open Bash here"
"Icon"=hex(2):25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,\
00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,4c,00,\
6f,00,63,00,61,00,6c,00,5c,00,6c,00,78,00,73,00,73,00,5c,00,62,00,61,00,73,\
00,68,00,2e,00,69,00,63,00,6f,00,00,00
[HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\openbashhere\command]
import discord
from discord.ext import commands
from bs4 import BeautifulSoup
import re
import requests
import logging
"""
LOGGING
"""
@darkdreamingdan
darkdreamingdan / ips_db_utf8mb4.sql
Last active September 2, 2016 01:15
A SQL query execution to convert an already converted IPS4 board from utf8 into utf8mb4
ALTER TABLE `convert_apps` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `convert_apps` MODIFY `sw` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `convert_apps` MODIFY `app_key` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `convert_apps` MODIFY `name` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `convert_apps` MODIFY `db_driver` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `convert_apps` MODIFY `db_host` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `convert_apps` MODIFY `db_user` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `convert_apps` MODIFY `db_pass` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `convert_apps` MODIFY `db_db` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@darkdreamingdan
darkdreamingdan / Phpbb.db
Last active August 24, 2016 00:14
Update IPB phpBB migration, applications/convert/sources/Software/Core/Phpbb.db. Search for !MTA! for modifications
<?php
/**
* @brief Converter phpBB Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @subpackage Converter
* @since 21 Jan 2015
*/
@darkdreamingdan
darkdreamingdan / phpbb3_db_preprocess.py
Last active August 23, 2016 02:40
Fix mojibaking and convert [lua] tags for MTA forum migration
#!/usr/bin/python
# -*- coding: utf-8 -*-
import ftfy
import codecs
f = codecs.open('php3_db.sql', 'r', 'utf-8')
lineNo = 0
for line in f:
outline = line
@darkdreamingdan
darkdreamingdan / ipb_posts_postprocess.py
Last active August 29, 2016 15:37
IPB Post Process: Find and replace for MTA forum migration
#!/usr/bin/python
# -*- coding: utf-8 -*-
import codecs
import re
f = codecs.open('ips_posts.sql', 'r', 'utf-8')
lineNo = 0
_ESCAPE_RE = re.compile('[&<>"]')
@darkdreamingdan
darkdreamingdan / Sheet1.vb
Last active May 10, 2016 21:43
Play a sound embedded as an OLEObject in Excel #OLEObjectsinVBA
Private Sub CommandButton1_Click()
Dim EmbeddedFileName As String
Dim obj As OLEObject
' Loop through all our OLE Objects to find the one we want.
For Each obj In OLEObjects
' If it's our success sound...
If InStr(obj.Name, "sound_success") <> 0 Then
' We try to grab the embedded file name. We call this twice.
EmbeddedFileName = Module1.GetOLETempPath(obj) ' Once to create the file
EmbeddedFileName = Module1.GetOLETempPath(obj) ' Then to grab the filename