Skip to content

Instantly share code, notes, and snippets.

View MikSDigital's full-sized avatar
🎯
Focusing

Mikhail MikSDigital

🎯
Focusing
View GitHub Profile
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@RRobotek
RRobotek / facebot.py
Last active August 16, 2022 23:58
Cute little python script that adds facebook friends autopilot.
#!/usr/bin/env python
import time
HEADER = '\033[95m' # colours
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Which Browser?</title>
</head>
<body>
<p>You are using <span id="browser"></span> <span id="version"></span> on <span id="os"></span></p>
<script type="text/javascript" src="browserdetect.js"></script>
<script type="text/javascript">
@Remiii
Remiii / .htaccess
Created August 22, 2015 09:40
Symfony 2 redirect www to non-www with Apache .htaccess
# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex app.php
# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve
# to the front controller "/app.php" but be rewritten to "/app.php/app".
<IfModule mod_negotiation.c>
@nadar
nadar / PostMessageToSlackChannel.php
Last active June 5, 2024 17:05
Post a message to a slack channel with PHP
<?php
/**
* Send a Message to a Slack Channel.
*
* In order to get the API Token visit:
*
* 1.) Create an APP -> https://api.slack.com/apps/
* 2.) See menu entry "Install App"
* 3.) Use the "Bot User OAuth Token"
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Word Rotate</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
@igormukhingmailcom
igormukhingmailcom / README.md
Created May 16, 2015 20:09
Symfony2 configuration for file uploads & cropping at EasyAdminBundle with JbFileUploaderBundle for multiple entities
@webdevilopers
webdevilopers / FormController.php
Created May 6, 2015 13:11
Remove field type from symfony form using PRE_SET_DATA event
<?php
namespace Acme\AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Acme\AppBundle\Form\RemoveType;
@tomykaira
tomykaira / guzzle.php
Created January 7, 2015 10:57
Set user-agent in guzzle. client->setDefaultOption('headers/User-Agent', 'foo'); does not work for user-agent.
<?php
require 'vendor/autoload.php';
use Guzzle\Service\Client;
// Create a client with a base URL
$client = new Client('http://requestb.in/1ivmkhd1');
$client->setUserAgent('myuseragent');
// Send a request to https://github.com/notifications
$response = $client->get('')->send();
@mickelsonm
mickelsonm / main.go
Created November 24, 2014 02:44
Golang program to lookup stocks by symbols using Yahoo Finance API.
package main
import (
"encoding/json"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)