Skip to content

Instantly share code, notes, and snippets.

View psycalc's full-sized avatar
💭
DevOps Learning

Raziel psycalc

💭
DevOps Learning
View GitHub Profile
#!/bin/bash
if [ "$1" == "vasya" ]; then
echo "Privet $1"
elif [ "$1" == "jack" ]; then
echo "Hello $1"
else echo "Zdarova $1"
fi
x=""
while [ "$x" != "q" ]
@psycalc
psycalc / Dockerfile
Created September 21, 2021 07:26
create nginx config throu Dockerfile (for i.e laravel nginx config from alpine base image)
RUN echo $'# This is a default site configuration which will simply return 404, preventing\n\
# chance access to any other virtualhost.\n\
server {\n\
listen 80 default_server;\n\
listen [::]:80 default_server;\n\
# Everything is a 404\n\
location / {\n\
return 404;\n\
}\n\
# You may need this to prevent return 404 recursion.\n\
@psycalc
psycalc / Dockerfile
Last active September 21, 2021 06:48
Docker leave container runing (for i.e docker exec -it sh\bash inspect file systems and config files)
ENTRYPOINT ["/bin/ash", "-c", "sleep infinity"]
@psycalc
psycalc / gist:9d4ebd5a460d79959341a899bed21f1a
Created January 2, 2018 00:21
What is Mining Baby don't heart me no more....))))
do { //just repetance until condition Not (!) will be true
//just object of class with field Nonce this is integer type can be 1..2 ..3 -1.. -3.. -5.. -1000 ... 100.. 999 and so on
block.Nonce++; //Mining by incremention
block.Hash = BlockChainLibrary.Crypto.Sha256.CalcHash(block.ToHashString());
//method just return concatenated string Index+PreviousHash+Timestapm+Data+Nonce $"{Index}{PrevHash}{Timestamp}{Data}{Nonce}";
} while (!BlockChainLibrary.Crypto.Sha256.IsValidHash(block.Hash));
Blocks.Add(block);
@psycalc
psycalc / deleteAllScriptTag.ps1
Created December 22, 2017 11:36
regular expression for powershell inorder to delete all script tag from html
(?s)<script(\stype=("|')text\/javascript("|'))?(\ssrc=".*?")?>.*?</script>
@psycalc
psycalc / selectionToTable.gs
Last active October 16, 2017 11:48
Google app script to convert selection to table
//just add convenient menu to G suit
function onOpen() {
var ui=DocumentApp.getUi();
ui.createMenu('Макросы')
.addItem('SelectionToTable', 'myFunction')
.addItem('ImageFiller','imageFiller')
.addToUi();
//здесь можно дополнить менюшку
};
//main function
@psycalc
psycalc / MassRenameFiles.ps1
Created July 24, 2017 17:26
Mass rename files using regexp Windows
Get-ChildItem -File -Recurse
| % { Rename-Item -Path $_.PSPath -NewName $_.Name.replace("LoadedFromRam","")}
@psycalc
psycalc / gist:0958003fc6818f9ad846ff954dd44f71
Last active November 15, 2016 12:56
Angular Enter Key processing one button
<form ng-submit="myFunct(nick,value)"> //If one button it can process Enter shotcut key
<input id="nickinput" type="text" name="name" ng-model="nick" autofocus>
<input id="chatinput" type="text" name="name" ng-model="value">
<button ng-click="myFunc(nick,value)">Send</button>
</form>
//Controller
.controller('BodyController', function BodyController($scope, MyData) {
$scope.MyData = MyData;
$scope.myFunc = function(nick, s) {
@psycalc
psycalc / webSocketServer.js
Last active November 14, 2016 13:27
Working example of WebSocket server on NODE.js ['ws']
//dependency: https://github.com/websockets/ws
//dependency installation: npm install --save ws
var WebSocketServer = require('ws').Server,
wss = new WebSocketServer({
port: 8080
});
// Broadcast to all.
wss.broadcast = function broadcast(data) {
wss.clients.forEach(function each(client) {
@psycalc
psycalc / Observer.js
Last active November 4, 2016 16:46
JavaScript Design Patterns - Observer
function Observable () {
var observers = [];
this.sendMassage = function ( msg ) {
for (var i=0, i<observers.length;i++) {
observer[i].notify( msg );
}
}
this.addObserver = function ( observer) {
observers.push( observer );
};