Skip to content

Instantly share code, notes, and snippets.

View ram0973's full-sized avatar
:octocat:
Thinking

ram0973 ram0973

:octocat:
Thinking
View GitHub Profile
<?php
/**
* global.php file.
* Global shorthand functions for commonly used Yii methods.
* @author Christoffer Niska <christoffer.niska@gmail.com>
* @copyright Copyright &copy; Christoffer Niska 2013-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
@ram0973
ram0973 / DirsApp.cs
Created April 18, 2016 10:47
Печать всех подкаталогов на C#
using System;
using System.IO;
namespace DirsApp
{
class Program
{
private static void Main(string[] args)
{
DirectoryInfo root = new DirectoryInfo(".");
@ram0973
ram0973 / gist:d750c9f60bea3c83e67fe58a6f5c4b6b
Created October 26, 2016 06:45
Python: get If-Modified-Since Tag
timestamp = datetime.utcnow() - timedelta(seconds=60)
expiration_time = timestamp.strftime('%a, %d %b %Y %H:%M:%S GMT')
@ram0973
ram0973 / lxml_parse_html_tree.py
Created May 2, 2018 07:30
LXML tree iteration example
from lxml import etree
from io import StringIO
html = """"Hello, world!"<span class="black">
<div class="c1">division
<p>"Hello - this is me.
(c) passage in division"
<b>"bold in passage "</b>
</p>
My phone:
@ram0973
ram0973 / bs4_parse_html_tree.py
Created May 2, 2018 08:40
bs4 parse tree example
from bs4 import BeautifulSoup, Comment
SKIP_TAGS = ['style', 'script', 'meta', 'code', 'pre']
html = """
"Hello, world!"<span class="black">
<div class="c1">division
<p>"Hello - this is me.
(c) passage in division"
<b>"bold in passage "</b>
</p>
@ram0973
ram0973 / Pycharm hotkeys.txt
Last active May 2, 2018 13:42
Pycharm hotkeys
Ctrl+Q
Ctrl-Alt-T
Ctrl+B
Ctrl+Alt+влево
Ctrl+J
Ctrl+F12
Ctrl+G
Ctrl+D
Alt+Shift+C
Ctrl+Shift+A
@ram0973
ram0973 / pagination.html
Created May 20, 2018 15:05 — forked from oscarmcm/pagination.html
A Django template tag for pagination
{% load i18n %}
<div class="row">
<div class="col-xs-12">
<section class="paginator text-center">
<nav>
<ul class="pagination">
<li>
{% if page.has_previous %}
<a href="?page={{ page.previous_page_number }}" aria-label="Previous">
@ram0973
ram0973 / funtalk.ps1
Created August 21, 2018 21:54 — forked from jrgcubano/funtalk.ps1
Fun script powershell to talk with remote computer
# Link: http://www.reddit.com/r/PowerShell/comments/1khn9o/a_fun_script_for_friday_make_your_friends/
# A fun script for Friday - make your friend's computer start talking to him/her (self.PowerShell)
# submitted 1 year ago * by Sinisterly
# A co-worker of mine stumbled upon this nifty blog article on how to make a text-to-speech call using PowerShell.
# The article gives two examples:
# - Call the SAPI.SPVoice COM object
# - Load the reference to System.Speech
# Where can this come in fun? Well, if you throw PSRemoting in, of course! In my testing, if you use the second method (or the pared down script below) you can make your victim's computer start talking to him or her. Here's how you do it:
# 1. Provide a distraction so that your victim leaves their computer unlocked, and make yourself administrator on their workstation (only needed if you aren't already an admin!)
# 2. Enable PSRemoting on their workstation. A method for doing this would be using PSExec:
@ram0973
ram0973 / gist:b48485f2d2c0ce0be06e6aae4ee17954
Last active September 17, 2018 09:57
Ubuntu 18.04 + Docker + Vagrant + ConEmu + Zsh on Windows WSL
https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly
https://github.com/powerline/fonts
case $(uname -a) in
*Microsoft*) unsetopt BG_NICE ;;
esac
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Update-Help