Skip to content

Instantly share code, notes, and snippets.

View markdimi's full-sized avatar
🏋️‍♂️
Linear progression

Markos Dimitsas markdimi

🏋️‍♂️
Linear progression
  • Codebasegr
  • Between Germany and Greece
View GitHub Profile
@micktwomey
micktwomey / client.py
Created October 1, 2010 13:03
python multiprocessing socket server example
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = "some data"
sock.sendall(data)
result = sock.recv(1024)
print result
sock.close()
@bueltge
bueltge / post-process.php
Created June 24, 2011 21:08
WordPress Custom Post Type: Insert post via Frontend
<?php
/**
* post-process.php
* make sure to include post-process.php in your functions.php. Use this in functions.php:
*
* get_template_part('post-process');
*
*/
function do_insert() {
if( 'POST' == $_SERVER['REQUEST_METHOD']
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@zmwangx
zmwangx / fb-dl.py
Last active November 28, 2023 20:29
Scrape all photos from a public Facebook page.
#!/usr/bin/env python
############################### README ###############################
# External dependencies:
# * libmagic
# * python-dateutil
# * python-magic
# * requests
#
# The shell command call at the end was tested with GNU date from GNU
@bishboria
bishboria / springer-free-maths-books.md
Last active October 3, 2024 09:17
Springer made a bunch of books available for free, these were the direct links
@darencard
darencard / auto_git_file.md
Last active August 23, 2024 13:41
Automatic file git commit/push upon change

Please see the most up-to-date version of this protocol on my blog at https://darencard.net/blog/.

Automatically push an updated file whenever it is changed

Linux

  1. Make sure inotify-tools is installed (https://github.com/rvoicilas/inotify-tools)
  2. Configure git as usual
  3. Clone the git repository of interest from github and, if necessary, add file you want to monitor
  4. Allow username/password to be cached so you aren't asked everytime
@harshvardhanmalpani
harshvardhanmalpani / createCat.php
Created October 27, 2017 08:02
How to create Magento 2 category programmatically
<?php
//creating categories in magento 2
//last verified Magento 2.2.0 27 Oct 2017
use \Magento\Framework\App\Bootstrap;
echo 'code by harshvardhanmalpani';
include('./app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
function createCategory($a='',$b=2,$c=true,$d='',$e='',$f='',$g='') {
global $objectManager;
@WJDigby
WJDigby / sendmail.py
Last active August 3, 2023 13:21
python3 send email via gmail API
from apiclient.discovery import build
from apiclient import errors
from httplib2 import Http
from oauth2client import file, client, tools
from email.mime.text import MIMEText
from base64 import urlsafe_b64encode
SENDER = <sender>
RECIPIENT = <recipient>
@markdimi
markdimi / colored_dots.py
Last active May 12, 2019 14:29
Colored Icons to use in a palette
# A simple function that uses python3 and matplotlib, and creates a plain colored circle (transparent png image 500x500 px).
# Inputs are the color_list and and the name of the file.
# The color_list can include multiple colors. A single color create a circle with that color.
# Multiple colors create a circle divided equally by the sum of the colors
# my_dpi variable is needed in order to make matplotlib to print an image with a specific size (usually dpi=96).
# More on this SO post: https://stackoverflow.com/questions/13714454/specifying-and-saving-a-figure-with-exact-size-in-pixels
#
# here we are ploting a 500x500 image
# you can find your dpi by going here: https://www.infobyip.com/detectmonitordpi.php