Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/usr/local/sublime-text-3/sublime_text
Icon=/usr/local/sublime-text-3/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
@marnitto
marnitto / reversestring.c
Created June 14, 2015 14:51
Print reversed string
#include <stdio.h>
#include <stdlib.h>
#define BLOCK_SIZE 4096
int main(int argc, char *argv[])
{
char *buf, *tmp;
char ch;
size_t len=0;
@marnitto
marnitto / gist:8af03263fd33dae99ad6
Created June 14, 2015 14:55
PHP "Byebye, World!"
Byebye, World!
@marnitto
marnitto / img2pdf.py
Created July 19, 2015 14:08
img2pdf - merge multiple images to single PDF
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
img2pdf - Image(s) to pdf converter
Usage:
img2pdf.py <images_dir> [<pdf_name>]
"""
@marnitto
marnitto / gini.py
Created December 8, 2015 12:48
Simple Github Issue to IRC notification bot
# -*- coding: utf-8 -*-
import datetime
import os
import time
import github
import irc.bot
import schedule
@marnitto
marnitto / sudoku.py
Created May 4, 2016 15:49
Simple sudoku solver using z3
# -*- coding: utf-8 -*-
# Tested on z3 4.4.0, Python 2.7.9
#
# $ time python sudoku.py
# 5 3 4 6 7 8 9 1 2
# 6 7 2 1 9 5 3 4 8
# 1 9 8 3 4 2 5 6 7
# 8 5 9 7 6 1 4 2 3
# 4 2 6 8 5 3 7 9 1
@marnitto
marnitto / slack-download.py
Last active June 28, 2024 10:11
Slack file downloader from export archive
# -*- coding: utf-8 -*-
#
# Slack file downloader from export archive
#
# Requirements:
# Python 2 (or Python3 if you can use six)
#
# How to use:
# 1. Log in as admin, export your chat logs, and download archive.
# 2. Unarchive archive to directory (ex. TeamName export Apr 24 2016)
@marnitto
marnitto / player.py
Created August 19, 2016 11:33
PyCon 2016 APAC 가위바위보 코딩배틀
def show_me_the_hand(records):
try:
class AF(str): # for p2
def __eq__(self, *args, **kwarg):
return False
def __ne__(self, *args, **kwarg):
return True
class OTF(str): # for p1
@marnitto
marnitto / taskmem.py
Created February 20, 2017 09:03
List processes, sort by memory usage, group by image name on Windows
# Tested on Windows 7~, Python 2.7 and 3.6.
#
# -*- coding: utf-8 -*-
import subprocess
import operator
res = subprocess.check_output(['tasklist'])
res = res.split(b'\r\n')[2:]
# -*- coding: utf-8 -*-
import codecs
from bs4 import BeautifulSoup
import requests
html = requests.get('https://slackmojis.com/').text
soup = BeautifulSoup(html, 'html.parser')